import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

const store = new Vuex({
  store: {
    num: 1
  },

  getters: {
    getNum(state) {
      return state.num
    }
  },

  mutations: {
    addNumByProp(state, payload) {
      state.num += payload.num
    }
  },

  actions: {
    addNumByProp({commit}, payload) {
      store.commit('addNumByprop', payload)
    }
  }
})

export default store
